<!DOCTYPE html>
<#assign base=request.contextPath />
<html>
<head>
  <base href="${base}">
  <meta charset="utf-8">
  <title>在线考试系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="${base}/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="${base}/css/global.css" media="all">
  <link rel="stylesheet" href="${base}/css/style.css" media="all">
  <link rel="stylesheet" href="${base}/codemirror/lib/codemirror.css">
  <style>
  .layui-card-header {
  	height: auto;
  	line-height: 26px;
  }
  </style>
</head>

<body>

<div class="main">
	<div class="top1">
		<h2 style="padding-top:20px">${examine.name}</h2>
		<h2 style="padding:10px">《${examine.courseType.itemValue}》试卷</h2>
	</div>
	<div class="t1">
		<div class="t2">姓名：<span class="tit">${(student.fullname)!'测试用户'}</span></div>
		<div class="t2">学号：<span class="tit">${(student.username)!'2017250100X'}</span></div>
		<div class="t2">专业：<span class="tit">软件工程</span></div>
	</div>
	<div class="t1">
		<div class="t2">学院：<span class="tit">软件学院</span></div>
		<div class="t2">班级：<span class="tit">${(student.dept.depName)!'2017级'}</span></div>
		<div class="t2"><span class="tit2">2020年6月</span></div>
	</div>	
	<div>
		<table class="toptable">
			<tr>
				<td width="100">题号</td>
				<#list 1..data?size as i>
				<td><#if i==1>一</#if><#if i==2>二</#if><#if i==3>三</#if><#if i==4>四</#if><#if i==5>五</#if>
					<#if i==6>六</#if><#if i==7>七</#if><#if i==8>八</#if><#if i==9>九</#if><#if i==10>十</#if>
				</td>
				</#list>
				<td width="130">总分</td>
			</tr>
			<tr>
				<td>得分</td>
				<#list 1..data?size as i><td></td></#list>
				<td></td>
			</tr>
		</table>			
	</div>
	
	<form action="${base}/exam/student/saveExam?examId=${examine.oid}" method="post">
		<#list data as it>
		<div class="layui-card content">
			<div class="layui-card-header header2">
				<table class="ctable">
					<tr>
						<td>得分</td>
						<td>评卷人</td>
					</tr>
					<tr>
						<td></td>
						<td></td>
					</tr>
				</table>				
				<div class="ctit">
					<strong>${it_index+1}、${it.item.title}（${it.item.score}分）</strong> 
					<#if it.subQList?size==1>
						${it.subQList[0].content}
					<#else>
						<#list it.subQList as sq>
						（${sq_index+1}）${sq.content}
						</#list>						
					</#if>
				</div>
				
			</div>
			<div class="layui-card-body">
				<textarea id="code3" name="answer3">${(it.answer.content)!}</textarea>
			</div>
		</div>
		</#list>
		
		<div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
              <div class="layui-footer" style="left:0;padding:10px;text-align:center;z-index: 999;">
                <button id="submitBtn" class="layui-btn" type="button">我要交卷，立即提交</button>
              </div>
            </div>
    	</div>
	</form>

</div>


<script src="${base}/layuiadmin/layui/layui.js"></script>
<script src="${base}/codemirror/lib/codemirror.js"></script>
<script src="${base}/codemirror/mode/clike/clike.js"></script>
<script src="${base}/codemirror/addon/selection/active-line.js"></script>

<script>
layui.use(['util', 'layer'], function(){
    var $ = layui.$;
    var util = layui.util;
    var layer = layui.layer;
        
    $('textarea').each(function(elm) {
    	var editor = CodeMirror.fromTextArea(this, {
	   	  	mode: "text/x-java",
	   	  	styleActiveLine: true,
	   	  	lineNumbers: true,
	   	  	//readOnly: 'nocursor', //只读
	   	  	lineWrapping: true
    	});
    	
    	setTimeout(() => {
			editor.refresh();
    	}, 10);
    });  
    
    $('#submitBtn').click(function() {
    	if(layer.confirm('确定提交答卷吗？', {icon: 3, title:'提示'}, function(idx) {
    		$('form').submit();
    		
    		layer.close(idx);
    	}));
    });
});
</script>

</body>
</html>


